from django import template

register = template.Library()

@register.filter
def lookup(dictionary, key):
    """字典查找过滤器"""
    if isinstance(dictionary, dict):
        return dictionary.get(key, '')
    return ''
